<?php

/**
 * Define o formulário de autenticação dos utilizadores.
 * 
 * Implementa a Interface IForms
 * 
 * @author Ricardo Simão <code@rpsimao.com>
 * 
 * @version 1.1
 *
 */

class App_Forms_Login extends App_Forms_TemplateAbstract implements App_Interfaces_IForms {
	
	
	/**
	 * Nome do utilizador
	 *
	 * @var string
	 */
	protected $formText;
	
	/**
	 * Palavra passe
	 *
	 * @var string
	 */
	protected $formPassword;
	
	/**
	 * Botão de envio
	 *
	 * @var mixed
	 */
	protected $submitButton;
	
	/**
	 * Formulário de Autenticação
	 *
	 * @return Zend_Form
	 */
	public static function getForm() {
		
		$form = new Zend_Form ( );
		$form->setAction ( '/login' );
		$form->setMethod ( 'post' );
		
		$formText = new Zend_Form_Element_Text ( 'username' );
		$formText->setLabel ( 'Nome:' );
		$formText->setRequired ( true );
		$formText->setErrorMessages ( array (self::ERR_EMPTY_FIELD ) );
		$formText->setAttrib ( 'class', self::CLASS_BOX_TYPE_SMALL );
		$form->addElement ( $formText );
		
		$formPassword = new Zend_Form_Element_Password ( 'password' );
		$formPassword->setLabel ( 'Password:' );
		$formPassword->setRequired ( true );
		$formPassword->setErrorMessages ( array (self::ERR_EMPTY_FIELD ) );
		$formPassword->setAttrib ( 'class', self::CLASS_BOX_TYPE_SMALL );
		$form->addElement ( $formPassword );
		
		$form->addElement ( 'submit', 'submit' );
		$submitButton = $form->getElement ( 'submit' );
		$submitButton->setLabel ( 'Entrar' );
		
		return $form;
	}
}

?>